package hash;

import sun.security.provider.MD5;

import java.security.MessageDigest;

/**
 * @author yunfei.shang
 * @title
 * @date 2018/10/24 10:23
 * @descreption
 */
public class HashDemo {
    public static void main(String[] args) {
        try {
            String plainText = "http://apollo-api.idumiao.com/api/jimubox/project/dumiao3?startTime=2018-10-09&endTime=2018-10-25&limit=500&" +
                    "timeStamp=1540350902914&token=D1513660CB3976B65444BAA499317D27&merchantId=20170801&authToken=D1513660CB3976B65444BAA499317D27&feeGroupId=TEST_12";
            MessageDigest md = MessageDigest.getInstance("MD5");
            md.update(plainText.getBytes());
            byte b[] = md.digest();
            int i;
            StringBuffer buf = new StringBuffer("");
            for (int offset = 0; offset < b.length; offset++) {
                i = b[offset];
                if (i < 0) {
                    i += 256;
                }
                if (i < 16) {
                    buf.append("0");
                }
                buf.append(Integer.toHexString(i));
            }
            String re_md5 = buf.toString();
            System.out.println(re_md5);
        } catch (Exception ex) {
        }
    }
}
